package com.daro.ddlaunch.utils;

import com.daro.ddlaunch.pojo.Parameter;

import javax.websocket.EncodeException;
import javax.websocket.Encoder;
import javax.websocket.EndpointConfig;

public class ServerEncoder implements Encoder.Text<Parameter>{
    @Override
    public String encode(Parameter parameter) throws EncodeException {
        try {
            return Utils.parameter2JsonObject(parameter).toJSONString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
    @Override
    public void init(EndpointConfig endpointConfig) {

    }
    @Override
    public void destroy() {

    }
}
